var BATTLESHIPS = {'Destroyer': "Coral", 'Cruiser': "CornflowerBlue", 'Submarine': "Cornsilk", 'Battleship': "Crimson", 'Aircraft Carrier': "Cyan"};

function updateShips(gameboard, ships) {

    for (var ship in ships) {

        var shipString = ships[ship];

        for (var i = 0; i < shipString.length; i += 2) {

            $(gameboard+" [name=" + (shipString.substring(i, i + 2)) + "]").css({'background-color': BATTLESHIPS[ship], 'background-image': 'none'});

            console.log(shipString.substring(i, i + 2));
        }
    }
}

function updateShots(gameboard, hits, misses) {

    for (var i = 0; i < hits.length; i += 2) {

        $(gameboard+" [name=" + (hits.substring(i, i + 2)) + "]").css({'background-image': "url('./images/hit.jpg')"});
    }

    for (var i = 0; i < misses.length; i += 2) {

        $(gameboard+" [name=" + (misses.substring(i, i + 2)) + "]").css({'background-image': "url('./images/miss.jpg')"});
    }
}
